package com.yunji.cabinet.mapper;

import com.github.yulichang.base.MPJBaseMapper;
import com.yunji.cabinet.domain.CabinetTemplateDO;
import com.yunji.cabinet.dto.CabinetFiledDTO;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * @version 1.0
 * @Project: yunji-coffee
 * @Package com.yunji.cabinet.mapper
 * @FileName CabinetTemplateMapper.java
 * @Copyright Copyright © 2024 云集互联. All Rights Reserved
 * Company		com
 * @CreateTime 2024-04-07 16:59:41
 * @Description 货柜模板数据交互
 * @Modification Author                    History Time			Version				Description
 * --------------------------------------------------------------------------------
 * HuaAo				2024-04-07 16:59:41		1.0					1.0 Version
 * @since JDK 1.8.0_202
 */
public interface CabinetTemplateMapper extends MPJBaseMapper<CabinetTemplateDO> {

    /**
     * @param params 过滤条件
     * @Title searchTableField
     * @Desc 查找表字段信息
     * @Date 2024-08-26 14:00:27.048
     * @Return List<String> 匹配数据信息
     */
    @Select("        SELECT" +
            "        DISTINCT ${params.searchField}" +
            "        FROM" +
            "        template t" +
            "        WHERE t.`status` = 0" +
            "        <if test=\"params.agentId != null\">AND t.agent_id = #{agentId}</if>" +
            "        <if test=\"params.managerId != null\">ANd t.manager_id = #{managerId}</if>" +
            "        <if test=\"params.createName != null\">AND t.create_name LIKE concat('%', #{createName},'%')</if>")
    List<String> searchTableField(@Param("params") CabinetFiledDTO params);
}
